package com.chigga.application.config;

import com.chigga.application.interceptor.FaviconInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web 配置
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private FaviconInterceptor faviconInterceptor;

    /**
     * 注册并添加拦截器
     * @param registry 拦截器注册器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry
                // 添加 favicon 拦截器
                .addInterceptor(faviconInterceptor)
                // 拦截所有请求路径
                .addPathPatterns("/**");
    }

}